/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseMessageEntity.cs
*        创建系统时间:       2012/11/2 19:07:02
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseMessageEntity
    {
        private string categoryID;
        private string content;
        private string createDate;
        private string createUserID;
        private string createUserRealname;
        private string description;
        private bool enabled;
        private string functionID;
        private string id;
        private string ipAddress;
        public int IsNew;
        private string modifyDate;
        private string modifyUserID;
        private string objectID;
        private string parentID;
        public int ReadCount;
        private string receiverID;
        private string receiverRealname;
        private string sortCode;
        private string targetURL;
        private string title;

        public BaseMessageEntity()
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.functionID = string.Empty;
            this.categoryID = string.Empty;
            this.objectID = string.Empty;
            this.title = string.Empty;
            this.content = string.Empty;
            this.receiverID = string.Empty;
            this.receiverRealname = string.Empty;
            this.targetURL = string.Empty;
            this.ipAddress = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
        }

        public BaseMessageEntity(DataRow dataRow)
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.functionID = string.Empty;
            this.categoryID = string.Empty;
            this.objectID = string.Empty;
            this.title = string.Empty;
            this.content = string.Empty;
            this.receiverID = string.Empty;
            this.receiverRealname = string.Empty;
            this.targetURL = string.Empty;
            this.ipAddress = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseMessageEntity(DataTable dataTable)
        {
            this.id = string.Empty;
            this.parentID = string.Empty;
            this.functionID = string.Empty;
            this.categoryID = string.Empty;
            this.objectID = string.Empty;
            this.title = string.Empty;
            this.content = string.Empty;
            this.receiverID = string.Empty;
            this.receiverRealname = string.Empty;
            this.targetURL = string.Empty;
            this.ipAddress = string.Empty;
            this.description = string.Empty;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createUserRealname = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public BaseMessageEntity GetFrom(DataRow dataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldID]);
            this.ParentID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldParentID]);
            this.FunctionID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldFunctionID]);
            this.CategoryID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldCategoryID]);
            this.ObjectID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldObjectID]);
            this.ReceiverID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldReceiverID]);
            this.Title = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldTitle]);
            this.Content = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldContent]);
            this.IsNew = BaseBusinessLogic.ConvertToInt(dataRow[BaseMessageTable.FieldIsNew]);
            this.ReadCount = BaseBusinessLogic.ConvertToInt(dataRow[BaseMessageTable.FieldReadCount]);
            this.TargetURL = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldTargetURL]);
            this.IPAddress = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldIPAddress]);
            this.Enabled = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseMessageTable.FieldEnabled]);
            this.SortCode = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldSortCode]);
            this.Description = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldDescription]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldCreateUserID]);
            this.CreateUserRealname = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldCreateUserRealname]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldCreateDate]);
            this.ModifyUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldModifyUserID]);
            this.ModifyDate = BaseBusinessLogic.ConvertToString(dataRow[BaseMessageTable.FieldModifyDate]);
            return this;
        }

        public BaseMessageEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public string CategoryID
        {
            get
            {
                return this.categoryID;
            }
            set
            {
                this.categoryID = value;
            }
        }

        public string Content
        {
            get
            {
                return this.content;
            }
            set
            {
                this.content = value;
            }
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public string CreateUserRealname
        {
            get
            {
                return this.createUserRealname;
            }
            set
            {
                this.createUserRealname = value;
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        public string FunctionID
        {
            get
            {
                return this.functionID;
            }
            set
            {
                this.functionID = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string IPAddress
        {
            get
            {
                return this.ipAddress;
            }
            set
            {
                this.ipAddress = value;
            }
        }

        public string ModifyDate
        {
            get
            {
                return this.modifyDate;
            }
            set
            {
                this.modifyDate = value;
            }
        }

        public string ModifyUserID
        {
            get
            {
                return this.modifyUserID;
            }
            set
            {
                this.modifyUserID = value;
            }
        }

        public string ObjectID
        {
            get
            {
                return this.objectID;
            }
            set
            {
                this.objectID = value;
            }
        }

        public string ParentID
        {
            get
            {
                return this.parentID;
            }
            set
            {
                this.parentID = value;
            }
        }

        public string ReceiverID
        {
            get
            {
                return this.receiverID;
            }
            set
            {
                this.receiverID = value;
            }
        }

        public string ReceiverRealname
        {
            get
            {
                return this.receiverRealname;
            }
            set
            {
                this.receiverRealname = value;
            }
        }

        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        public string TargetURL
        {
            get
            {
                return this.targetURL;
            }
            set
            {
                this.targetURL = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }
    }
}